using System;
using System.IO;
using System.Text;
using System.Globalization;
using System.Resources;
using System.Xml.Serialization;
using System.Xml;

namespace CSF.Communications.Sdp.ServiceLogic.Entities
{
	/// <summary>
	/// Summary description for ModifyStateRequest.
	/// </summary>
	[XmlRootAttribute("ModifyStateRequest",IsNullable=false,Namespace="http://www.microsoft.com/csf/20/wes")]
	[Serializable]
	public class ModifyStateRequest : ModifyStateBase
	{
		#region members
      
		private string startState;
		private string action;
		private string endState;
        private VasRequestInternalParameters parameters;


		#endregion
 
		#region Constructor
		/// <summary>
		/// This is the default constructor for the class.Here the required constants are read 
		/// from the resources file and necessary initializations and instantiations of 
		/// the objects which are used throughout the class are done.
		/// </summary>
		public ModifyStateRequest()
		{
			try
			{
                parameters = new VasRequestInternalParameters();
				startState = String.Empty;
				action = String.Empty;
				endState = String.Empty;

			}
			catch(Exception wesRequestException )
			{
				throw (wesRequestException);
			}
			finally
			{
			}
         
		}
		#endregion
    
		#region SerializeObject
		/// <summary>
		/// This method returns an xml representation of the object
		/// </summary>
		/// <returns>The xml resprestation as Srting</returns>
		public string SerializeObject()
		{
			StringBuilder serialBuilder ;
			StringWriter serialWriter ;
			XmlSerializer messageSerializer;
			try
			{
				serialBuilder = new StringBuilder(1000);
				serialWriter = 
					new StringWriter(serialBuilder,CultureInfo.InvariantCulture);
				messageSerializer = new XmlSerializer(this.GetType());
				messageSerializer.Serialize(serialWriter,this);
				return serialWriter.ToString();
			}
			catch(Exception serializeObjectException )
			{
				throw (serializeObjectException );
			}
			finally
			{
				serialBuilder = null;
				serialWriter  = null;
				messageSerializer = null;
			}
		}
		#endregion

		#region DeserializeObject

		/// <summary>
		///	This method deserializes the input string into a ModifyState Request object
		/// </summary>
		/// <param name="xmlInput">The string to be deserialized</param>
		/// <returns>Populated ModifyStateRequest object</returns>
		public static ModifyStateRequest DeserializeObject(string xmlInput)
		{
        
			StringReader messageStreamer; 
			XmlReader messageReader ;
			XmlSerializer messageDeserial ;
			ModifyStateRequest modifyStateRequest;
			try
			{
             
				//  deserialize
				messageStreamer = new StringReader(xmlInput);
				messageReader = new XmlTextReader(messageStreamer);
				messageDeserial = new XmlSerializer(typeof(ModifyStateRequest));
            
				modifyStateRequest = (ModifyStateRequest)messageDeserial.Deserialize(messageReader);

				return modifyStateRequest ;
			}
			catch(Exception deserializeObjectException )
			{
				throw deserializeObjectException;
			}
			finally
			{
				messageStreamer = null; 
				messageReader  = null; 
				messageDeserial  = null; 
			}

		}

		#endregion DeserializeObject
    
		#region Properties
      
		/// <summary>
		/// Get / Set property for startState
		/// </summary>
		[XmlElement("StartState",Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
		public string StartState
		{
			get
			{
				return  startState;
			}

			set
			{
				startState= value ;
			}
		}

		/// <summary>
		/// Get / Set property for action
		/// </summary>
		[XmlElement("Action",Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
		public string Action
		{
			get
			{
				return  action;
			}

			set
			{
				action = value  ;
			}
		}

		/// <summary>
		/// Get / Set property for endState
		/// </summary>
		[XmlElement("EndState",Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
		public string EndState
		{
			get
			{
				return  endState;
			}

			set
			{
				endState = value   ;
			}
		}

		/// <summary>
		/// Get / Set property for parameters
		/// </summary>
		[XmlElement("Parameters",Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
		public VasRequestInternalParameters Parameters
		{
			get
			{
				return parameters;
			}
			set
			{
				parameters = value;
			}
		}
		#endregion    
	}
}
